<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity6">
<head>
    <meta charset="UTF-8">
    <title>Home</title>
</head>
<body>
登录账号:<span sec:authentication="name">123</span><br/>
登录账号:<span sec:authentication="principal.username">456</span><br/>
凭证：<span sec:authentication="credentials">456</span><br/>
权限和角色：<span sec:authentication="authorities">456</span><br/>
客户端地址：<span sec:authentication="details.remoteAddress">456</span><br/>
sessionId：<span sec:authentication="details.sessionId">456</span><br/>
<script>
    console.log(principal)

</script>

通过权限判断：
<button sec:authorize="hasAuthority('stu:insert')">新增</button>
<button sec:authorize="hasAuthority('stu:delete')">删除</button>
<button sec:authorize="hasAuthority('stu:update')">修改</button>
<button sec:authorize="hasAuthority('stu:select')">查看</button>
<br/>
通过角色判断：
<button sec:authorize="hasRole('管理员')">新增</button>
<button sec:authorize="hasRole('管理员')">删除</button>
<button sec:authorize="hasRole('管理员')">修改</button>
<button sec:authorize="hasRole('管理员')">查看</button>

<a href="/logout">退出登录</a>
</body>
</html>